package leetcode.n2021;

import java.util.ArrayList;
import java.util.List;

/**
 * https://leetcode-cn.com/problems/fizz-buzz/description/
 * https://leetcode.com/problems/fizz-buzz/?tab=Description
 * @program: brushing
 * @description:
 * @author: LiuQiang
 * @create: 2018-07-25 10:36
 **/
public class FizzBuzz {
    public List<String> test(int n) {
        List<String> infoList = new ArrayList<String>();

        if (n == 0) {
            return infoList;
        }

        for (int i = 1; i <= n; i++) {
            String s = String.valueOf(i);

            if (i % 3 == 0)// 就是3的倍数
            {
                s = "Fizz";
            }

            if (i % 5 == 0)// 就是5的倍数
            {
                s = "Buzz";
            }

            if (i % 3 == 0 && i % 5 == 0) {
                s = "FizzBuzz";
            }

            infoList.add(s);
        }

        return infoList;
    }

    public static void main(String[] args) {
        FizzBuzz fb = new FizzBuzz();
        List<String> infoList = fb.test(15);
        for (String str : infoList) {
            System.out.println(str);
        }
    }
}
